<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>资料-机构中心-魔步网</title>
<?php include_once(VIEWPATH."public/header_title.php");?>
<link href="<?php echo _get_cfg_path('css')?>base.css" type="text/css" rel="stylesheet" />
<link href="<?php echo _get_cfg_path('css')?>common.css" type="text/css" rel="stylesheet" />
<link href="<?php echo _get_cfg_path('lib')?>uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" href="<?php echo _get_cfg_path('lib')?>kindeditor/themes/default/default.css" />
<!--[if IE 6]>
<script src="<?php echo _get_cfg_path('js')?>DD_belatedPNG.js" type="text/javascript" ></script>
<script>DD_belatedPNG.fix('a,img');</script>
<![endif]-->
</head>
<body>
<?php include_once(VIEWPATH."public/header.php");?>
<div class="mainbody" id="mainbody">
    <div class="container mrgB30">
        <div class="member clearfix">
            <?php include_once(VIEWPATH."m/public/left_menu.php");?>
            <div class="fr uc_content">
              <?php include_once(VIEWPATH."m/public/notice.php");?>
                <div class="clearfix uitopg">
                  <div class="fl um_uitop">
                    <form method="post" action="" id="xtform">
                      <div class="authent">
                        <div class="aut_bti">机构资料</div>
                          <?php echo validation_errors('<div class="error">', '</div>');?>
                          <?php
                          	  $res = $this->input->get('res');
	                          if (isset($res))
	                          {
	                              if($this->input->get('res'))
	                              {
	                                $msg = '提交成功';
	                              }
	                              else
	                              {
	                              	$msg = '提交失败';
	                              }
	                              echo '<div class="authent_status"><i></i>'.$msg.'</div>';
	                          }
                          ?>
                          <table class="aut_tab profile info_instab" width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                  <td>
                                  	<a class="info_tab info_tab_on" href="<?php echo $infoUrl?>">基本信息</a>
                                  </td>
                                  <td>
                                  	<a class="info_tab" href="/m/photo?flag=1">头像设置</a>
                                  </td>
                                  <td>
                                  	<a style="float:right;width:50px;" href="javascript:void(0);" class="edit_ope show_info">修改</a>
                                  </td>
                              </tr>
                              <tr>
                                <td><span class="tips">*</span>类&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型</td>
                                <td class="show_info">
                                	<?php 
                                		$oSysStr = '';
                                		foreach ($oSysType as $key => $v)
                                		{
                                			if(strpos(','.$o['type'].',',','.$key.',')>-1)
                                			{
                                				if ($oSysStr)
                                				{
                                					$oSysStr .= ','.$v;
                                				}
                                				else
                                				{
                                					$oSysStr = $v;
                                				}
                                			}
                                		}
                                		echo $oSysStr;
                                	?>
                                </td>
                                <td class="edit_info">
                                <?php if ($o["cert_status"] == 1):?>
                                	<input type="hidden" id="cert_status_ins" value="1"/>
                                	<input type="hidden" name="type[]" value="<?=$o["type"]?>"/>
	                                	<?php foreach ($oSysType as $key => $v):?>
	                                		<?php if(strpos(','.$o['type'].',',','.$key.',')>-1) echo $v." ";?>
	                                  	<?php endforeach;?>
                                <?php else :?>
                                	<?php foreach ($oSysType as $key => $v):?>
	                                    <input class="ck" type="checkbox" name="type[]" onclick="checktype(this)" value="<?=$key?>"<?php if(strpos(','.$o['type'].',', ','.$key.',')>-1) echo ' checked';?> /><?=$v?>
	                                <?php endforeach;?>
								<?php endif;?>
                                </td> 
                              </tr>
                              <tr>
                                <td width="80">
                                	<span class="tips">*</span><span class="nick_name_label">全&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称</span>
                                </td>
                                <td class="show_info"><?=$o['nickname']?></td>
                                <td class="edit_info">
                                	<input id="insName" name="nickname" type="text" class="txt" value="<?=$o['nickname']?>" placeholder="机构名/摄影师/化妆师"/>
                                </td>
                              </tr>
                              <tr>
                              	<td>
                              		<span class="tips">*</span><span class="com_short_label">简&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;称</span>
                              		<input type="hidden" value="<?=$o['com_short']?'1':'2'?>" id="show_hidden_flag"/>
                              	</td>
                                <td class="show_info"><?=$o['com_short']?></td>
                                <td class="edit_info"><input id="com_short" name="com_short" type="text" value="<?php echo $o['com_short']?>" class="txt" placeholder="机构名/摄影师/化妆师"/></td>
                              </tr>
                              <tr>
                              	<td><span class="tips">*</span>联系电话</td>
                              	<td class="show_info"><?=$o['com_phone']?></td>
                                <td class="edit_info"><input id="com_phone" name="com_phone" type="text" value="<?php echo $o['com_phone']?>" class="txt" placeholder="例：15712345678"/></td>
                              </tr>
                              <tr>
                              	<td><span class="tips">*</span>QQ</td>
                              	<td class="show_info"><?=$o['qq']?></td>
                                <td class="edit_info"><input id="qq_ins" name="qq" type="text" value="<?php echo $o['qq']?>" class="txt" placeholder="腾讯QQ号"/></td>
                              </tr>
                              <tr>
                              	<td><span class="tips">*</span>所在地区</td>
                              	<td class="show_info"><?=$o['city']?></td>
                                <td class="edit_info">
                                	<div id="city_4" style="margin-top:8px">
                                    	<select class="prov txt" style="width:100px;margin-right:10px;" name="prov"></select> 
                                        <select class="city txt" style="width:100px;margin-right:10px;" name="city" disabled="disabled"></select>
                                        <select class="dist txt" style="width:100px" name="dist" disabled="disabled"></select>
                                    </div>
                                </td>
                              </tr>
                              <tr>
                              	<td><span class="tips">*</span>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱</td>
                              	<td class="show_info"><?=$o['com_email']?></td>
                                <td class="edit_info"><input id="com_email"  name="com_email" type="text" value="<?php echo $o['com_email']?>" class="txt" placeholder="邮箱地址"/></td>
                              </tr>
                              <tr>
                              	<td><span class="tips">&nbsp;</span>网&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址</td>
                              	<td class="show_info"><?=$o['website']?></td>
                                <td class="edit_info"><input name="com_website" id="com_website" type="text" value="<?php echo $o['website']?>" class="txt" placeholder="公司官方地址"/></td>
                              </tr>
                              <tr>
                                <td><span class="tips">*</span>LOGO</td>
                                <td class="show_info"><img style="max-width:200px;" border=0 src='<?=$o['showimg']?'/'.$o['showimg']:''?>'/></td>
                                <td class="edit_info">
                                <div id="previews" class="drsMoveHandle">
                                          <img class="img1" id="show_idnoimg3" border="0" src="<?=$o['showimg']?'/'.$o['showimg']:''?>"/>
                                      </div>
                                    <div class="f_note">
                                        <p>尺寸：248×324像素</p>
                                        <input type="hidden"  name="showimg" id="showimg" value="<?=$o['showimg']?>">
                                        <em><i class="icoPro16"></i>仅支持JPEG，上传图片大小不能超过1M</em>
                                        <div class="file_but">
                                        	<input name="showimg_upload" value="选择展示图" type-data="选择展示图" length-data="248" height-data="324" imgid-data="show_idnoimg3" imgval-data="showimg" class="cut_pic showimg_upload" type="button"/>
<!--                                             <input id="showimg_upload" name="showimg_upload" value="选择展示图" class="inp_file" type="file"> -->
                                        </div>
                                    </div>
                                    <div id="show_showimg">
                                        <?php if($o['showimg']):?>
                                          <a href="<?='/'.$o['showimg']?>" target="_blank">查看</a>
                                        <?php endif?>
                                    </div>
                                </td>
                              </tr>
                              <tr>
                                <td><span class="tips">*</span>主页背景图</td>
                                <td class="show_info"><img style="max-width:200px;" border=0 src='<?=$o['bgimg']?'/'.$o['bgimg']:''?>'/></td>
                                <td class="edit_info">
                                <div id="previews" class="drsMoveHandle">
                                          <img id="show_idnoimg2" border="0" src="<?=$o['bgimg']?'/'.$o['bgimg']:''?>">
                                      </div>
                                    <div class="f_note">
                                        <p>尺寸：1100×430像素</p>
                                        <input type="hidden"  name="bgimg" id="bgimg" value="<?=!empty($o['bgimg'])?$o['bgimg']:''?>"/>
                                        <em><i class="icoPro16"></i>在个人主页上显示, 上传图片大小不能超过1M</em>
                                        <div class="file_but">
                                        	<input name="showimg_upload" value="选择展示图" type-data="选择展示图" length-data="1100" height-data="430" imgid-data="show_idnoimg2" imgval-data="bgimg" class="cut_pic showimg_upload" type="button"/>
<!--                                             <input id="bgimg_upload" name="bgimg_upload" value="选择照片" class="inp_file" type="file"> -->
                                        </div>
                                    </div>
                                    <div id="show_bgimg">
                                        <?php if(!empty($o['bgimg'])):?>
                                          <a href="<?='/'.$o['bgimg']?>" target="_blank">查看</a>
                                        <?php endif?>
                                    </div>
                                </td>
                              </tr>
                              <tr class="ins_per_show">
                                <td><span class="tips">*</span>管理员姓名</td>
                                <td class="show_info"><?=$o['realname']?></td>
                                <td class="edit_info"><input id='realname' name="realname" type="text" value="<?=$o['realname']?>" class="txt" placeholder="请输入姓名"/><?php //echo form_error('realname');?></td>
                              </tr>
                              <tr class="ins_per_show">
                              	<td><span class="tips">*</span>手机</td>
                              	<td class="show_info"><?=$o['mobile']?></td>
                                <td class="edit_info"><input id="mobile" name="mobile" type="text" value="<?php echo $o['mobile']?>" class="txt" placeholder="手机"/></td>
                              </tr>
                              <!-- <tr>
                              	<td><span class="tips">*</span>邮箱</td>
                                <td><input id="email" name="email" type="text" value="<?php echo $o['email']?>" class="txt" placeholder="邮箱地址"/></td>
                              </tr>
                              <tr>
                              	<td><span class="tips">*</span>微信号</td>
                                <td><input id="wechat" name="wechat" type="text" value="<?php echo $o['wechat']?>" class="txt" placeholder="微信号"/></td>
                              </tr> -->
                              <tr>
                                 <td><span class="tips">*</span><span class="memo_label">机构简介</span></td>
                                 <td class="show_info"><?=strip($o['memo'])?></td>
                                 <td class="edit_info"><textarea id="memo" name="memo" cols="" rows=""><?=!empty($o['memo'])?$o['memo']:'';?></textarea></td>
                              </tr>
                              <tr class="edit_info" style="border-bottom:none;">
                                <td style="height:80px">&nbsp;</td>
                                <td>
                                    <input id="submitTwo" name="submit" type="submit" class="but" value="保存"/>
                                    <!--<input name="" type="button" class="but but_reset" value="重置"/>-->
                                </td>
                              </tr>
                          </table>
                        </div>
                      </form>
                    </div>
                    <div class="fr um_wind">
                      <?php include_once(VIEWPATH."m/public/right.php");?>
                    </div>
                </div>
            </div>
        </div>
        <div class="help_bottom"></div>
    </div> 
</div>

<!-- 弹出层 -->
<div class="popover-mask"></div>
<div class="popover complaint popover_works" style="height:auto;margin:-260px 0 0 -230px;">
    <div class="compl_top">
        <span class="fl" id="X-title">添加图片</span>
        <a href="javascript:;" id="TX-win-close" title="关闭" class="close fr">×</a></div>
  <div class="compl_con">
      <form action="/public/upload/catupload" method="post" id="catupload_form" enctype="multipart/form-data">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <input type="hidden" name="albumid" id="albumid" value=""/>
            <input type="hidden" name="agid" id="agid" value="<?=$this->input->get('agid')?>"/>
            <tr><td height="10"></td></tr>
            <tr>
              <td width="80"><font id="pic_label">照片：</font></td>
              <td>
              	<div class="filebox" style="height:91px;">
              	
              	<input type="hidden" id="show_cat_img_width"/>
              	<input type="hidden" id="show_cat_img_height"/>
              	
              	 <input type="hidden" name="width" id="length_size" />
              	 <input type="hidden" name="height" id="height_size" />
              	 <input type="hidden" name="rel_width" id="rel_width_size"/>
              	 <input type="hidden" name="rel_height" id="rel_height_size"/>
              	 <input type="hidden" id="img_url" />
              	 <input type="hidden" id="img_val" />
                 <div class="upload_btn photo_left_bg" style="top:0px;">
                    <a href="javascript:" style="text-align:center;margin-top:10px;">选择图片<input type="file" onChange="catimg_upload(this)" id="cover" name="cover"></a>
                    <br/>
                    <span style="margin-left:20px;">支持JPG/PNG/GIF，上传图片大小不能超过1M</span>
                 </div>
              	   <div class="left fl">
                     <div id="localImag"><img id="preview1" src="" style="display:none;"/></div>
                     <!--通过生成尺寸和旋转角度 后台获取尺寸和旋转角度再进行裁剪-->
                     <input id="id_top" type="hidden" name="top" value="0">  <!--x轴-->
                     <input id="id_left" type="hidden" name="left" value="0"><!--y轴-->
                     <input id="id_right" type="hidden" name="right" value="0"><!--w轴-->
                     <input id="id_bottom" type="hidden" name="bottom" value="0"><!--h轴-->
                     <input id="id_widthPro" type="hidden" name="widthPro" value=""><!--宽度比例，原：现-->
                     <input id="id_heightPro" type="hidden" name="heightPro" value=""><!--高度比例，原：现-->
                     <input id="rotation" type="hidden" value="0" name="rotation">
                   </div>
                </div>
              </td>
            </tr>
            <tr><td height="10"></td></tr>
            <tr><td height="10"></td></tr>
            <tr>
              <td>&nbsp;</td>
              <td><input class="but commit_album" name="" onclick="catimg_save()"  type="button" value="保存"/><span id="T-msg"></span></td>
            </tr>
        </table>
      </form>
    </div>
</div>

<!--mainbody-->
<?php include_once(VIEWPATH."public/footer.php");?>
</body>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="<?=_get_cfg_path('js')?>jquery.imgareaselect.js"></script>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>common.js"></script>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>jquery.SuperSlide.2.1.1.js"></script>
<script>jQuery(".txtScroll-top").slide({titCell:".hd ul",mainCell:".bd ul",autoPage:true,effect:"topLoop",autoPlay:true});</script>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>jquery.validate.min.js"></script>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>pages/m/info.js"></script>
<script src="<?php echo _get_cfg_path('lib')?>uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<script charset="utf-8" src="<?php echo _get_cfg_path('lib')?>kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="<?php echo _get_cfg_path('lib')?>kindeditor/lang/zh_CN.js"></script>
<style type="text/css">.ke-container-default{width:500px !important;}.ke-edit,.ke-edit-iframe{height:200px !important;}.tips{margin:10px 5px 0 0;}</style>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>jquery.cityselect.js"></script>
<script type="text/javascript" src="<?php echo _get_cfg_path('js')?>pages/m/ajaxfileupload.js"></script>
<script type="text/javascript">
$(function(){
	//demo04
	$("#city_4").citySelect({
    	prov:"<?php echo $o['com_prov']?>", 
    	city:"<?php echo $o['com_city']?>",
        dist:"<?php echo $o['com_dist']?>",
        nodata:"none"
	}); 
});

//机构类型选择限定数量
function checktype(obj)
{
	var arr = $("input[name='type[]']:checked");
	if(arr.length > 3)
	{
		alert("最多可选3个");
		$(obj).attr("checked",false);
	}
}


<?php $timestamp = $this->timestamp;?>
$(function() {
  setTimeout(function(){
    $('#userlogo_upload').uploadify({
      'formData'     : {
        'timestamp' : '<?php echo $timestamp;?>',
        'token'     : '<?php echo md5($this->config->item('encryption_key') . $timestamp );?>',
        'type' : 'userlogo',
        'uid' : <?php echo $this->loginID;?>
      },
      'auto':true,
      //'buttonClass':'inp_btn',
      'fileSizeLimit' : '1024KB',
      'buttonText':'选择照片',
      'fileTypeExts': '*.jpg;*.png;*.jpeg',
      //'buttonImage' : '{$js_url}uploadify/button.png',
      'swf'      : '<?php echo _get_cfg_path("lib")?>uploadify/uploadify.swf',
      'uploader' : '/public/upload/uploadimg',
      'onUploadSuccess' : function(file, data, response) {
        if (!data){
         alert('上传失败');
         return;
        }
        data = data.split('|');
        if (data[0] == 100){
          $('#userlogo').nextAll('em').html('<i class="icoErr16"></i>'+data[1]);
        }else if(data[0] == 200 && data[1]!=''){
          var imgpath=data[1];
          $('#userlogo').val(imgpath);
          $('#userlogo').nextAll('em').html('<i class="icoCor16"></i>');
          $('#show_userlogo').attr('src','/'+imgpath);
        }
      }

    });

    $('#showimg_upload').uploadify({
      'formData'     : {
        'timestamp' : '<?php echo $timestamp;?>',
        'token'     : '<?php echo md5($this->config->item('encryption_key') . $timestamp );?>',
        'type' : 'showimg',
        'uid' : <?php echo $this->loginID;?>
      },
      'auto':true,
      //'buttonClass':'inp_btn',
      'fileSizeLimit' : '1024KB',
      'buttonText':'选择展示图',
      'fileTypeExts': '*.jpg;*.png;*.jpeg',
      //'buttonImage' : '{$js_url}uploadify/button.png',
      'swf'      : '<?php echo _get_cfg_path("lib")?>uploadify/uploadify.swf',
      'uploader' : '/public/upload/uploadimg',
      'onUploadSuccess' : function(file, data, response) {
        if (!data){
         alert('上传失败');
         return;
        }
        data = data.split('|');
        if (data[0] == 100){
          $('#showimg').nextAll('em').html('<i class="icoErr16"></i>'+data[1]);
        }else if(data[0] == 200 && data[1]!=''){
          var imgpath=data[1];
          $('#showimg').val(imgpath);
          $('#showimg').nextAll('em').html('<i class="icoCor16"></i>');
          //$('#show_showimg').html('保存后可查看');
          //$('#show_showimg').attr('src','/'+imgpath);
		   $('#show_idnoimg3').attr('src','/'+imgpath);
        }
      }

    });

    $('#bgimg_upload').uploadify({
      'formData'     : {
        'timestamp' : '<?php echo $timestamp;?>',
        'token'     : '<?php echo md5($this->config->item('encryption_key') . $timestamp );?>',
        'type' : 'bgimg',
        'uid' : <?php echo $this->loginID;?>
      },
      'auto':true,
      //'buttonClass':'inp_btn',
      'fileSizeLimit' : '1024KB',
      'buttonText':'选择展示图',
      'fileTypeExts': '*.jpg;*.png;*.jpeg',
      //'buttonImage' : '{$js_url}uploadify/button.png',
      'swf'      : '<?php echo _get_cfg_path("lib")?>uploadify/uploadify.swf',
      'uploader' : '/public/upload/uploadimg',
      'onUploadSuccess' : function(file, data, response) {
        if (!data){
         alert('上传失败');
         return;
        }
        data = data.split('|');
        if (data[0] == 100){
          $('#bgimg').nextAll('em').html('<i class="icoErr16"></i>'+data[1]);
        }else if(data[0] == 200 && data[1]!=''){
          var imgpath=data[1];
          $('#bgimg').val(imgpath);
          $('#bgimg').nextAll('em').html('<i class="icoCor16"></i>');
          //$('#show_bgimg').attr('src','/'+imgpath);
         // $('#show_bgimg').html('保存后可查看');
		$('#show_idnoimg2').attr('src','/'+imgpath);
        }
      }

    });

  },10);
});

  var editor;
  KindEditor.ready(function(K) {
    editor = K.create('textarea[name="memo"]', {
      resizeType : 1,
      allowPreviewEmoticons : false,
      allowImageUpload : true,
      items : [
        'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
        'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
        'insertunorderedlist', '|', 'emoticons', 'image', 'link']
    });
  });

</script>
</html>